package ThreadDemo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 阿宾
 * Date: 2025-03-17
 * Time: 09:31
 */
public class ThreadDemo7 {
    public static void main(String[] args) {
        Thread t = new Thread(
                () -> {
                    while (true) {
                        System.out.println("hello runnable");
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
        );
        //在start之前，调整线程为后台线程
        t.setDaemon(true);
        //开启线程
        t.start();

    }
}
